package cn.col.gszf.service.impl;

import cn.col.gszf.mapper.VoteOptionsMapper;
import cn.col.gszf.pojo.VoteOptions;
import cn.col.gszf.service.VoteOptionsService;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @Description
 * @Author zhaoning
 * @Date 2024/6/25
 */
@Service
public class VoteOptionsServiceImpl implements VoteOptionsService {

    @Resource
    public VoteOptionsMapper voteOptionsMapper;

    @Override
    public void updateVotingCount(Integer optionId, Integer count) {
        UpdateWrapper<VoteOptions> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("id",optionId).set("total_voting", count);
        voteOptionsMapper.update(null, updateWrapper);
    }
}
